import 'package:flutter/cupertino.dart';
import 'package:flutter_base/http/api.dart';

import '../../bean/hot/common_website_entity.dart';
import '../../bean/hot/search_hot_key_entity.dart';
import '../../http/dio_instance.dart';

///
/// @DIR_PATH：lib/viewmodel/hot
/// @TIME：2024/6/11 14:44
/// @AUTHOR：starr
///
class HotKeyViewModel with ChangeNotifier {
  List<CommonWebsiteEntity>? websiteList;

  List<SearchHotKeyEntity>? hotKeyList;


  //统一获取数据，再去notifyListeners刷新界面
  Future initHotData() async{
    getCommonWebsiteData().then((value){
      getSearchHotKeyData().then((value){
        notifyListeners();
      });
    });
  }

  //常用网站
  Future getCommonWebsiteData() async {
    websiteList = await Api.instance.getCommonWebsiteData();
  }

  //搜索热词网站
  Future getSearchHotKeyData() async {
    hotKeyList = await Api.instance.getSearchHotKeyData();
  }
}
